package chp07;

import java.util.Arrays;

public class Test12b {
    public static void main(String[] args) {
        //删除和新增
        //删除
        String[] names = {"jack","tom","mike","peter","jim"};
        System.out.println(Arrays.toString(names));
        int index = 1;
        //移位的算法
        for(int i = index; i < names.length-1; i++){
            names[i] = names[i+1];
        }
        //把最后一位变为null
        names[names.length-1] = null;
        // [jack, mike, peter, jim, null]
        System.out.println(Arrays.toString(names));
    }
}
